#coding=utf-8

from datetime import datetime

from django.db import models

# Create your models here.
CSSSTYLE = (
    ('red', '红色'),
    ('green', '绿色'),
    ('blue', '蓝色'),
    ('yellow', '橘黄'),
    ('grey', '灰色')
)
class Classify(models.Model):
    name = models.CharField(verbose_name='名字', max_length=20, blank=True)
    sort = models.IntegerField(verbose_name='排序', blank=True)
    def __unicode__(self):
        return self.name
    class Meta:
        verbose_name = '导航分类'
        verbose_name_plural = verbose_name
        
        
class NavPage(models.Model):
    name = models.CharField(max_length=50, blank=True, verbose_name='名称')
    url = models.URLField(blank=True, verbose_name='连接地址')
    color = models.CharField(max_length=100, blank=True, choices=CSSSTYLE, verbose_name='颜色')
    ico = models.CharField(max_length=100, blank=True, verbose_name='图标', default='')
    sort = models.IntegerField(blank=True, verbose_name='排序')
    is_activity = models.BooleanField(default=True,verbose_name="是否启用")
    category = models.ForeignKey(Classify, verbose_name='分类',blank=True)
    update_time = models.DateTimeField(default=datetime.now,verbose_name="添加时间")
    def __unicode__(self):
        return "{name}".format(name=self.name)
    class Meta:
        verbose_name = '导航配置'
        verbose_name_plural = verbose_name